<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>163-P215-作业-2</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        div {
            position: relative;
            height: 50px;
            background: pink;
        }

        div span {
            position: absolute;
            display: block;
            width: 25px;
            height: 25px;
            line-height: 25px;
            top: 10px;
            right: 100px;
            background-color: #fff;
            text-align: center;
        }
    </style>
</head>

<body>
    <!-- 2.京东关闭广告（直接隐藏即可） -->
    <div>广告<span>X</span></div>
    <script>
        var spn = document.querySelector('span');
        var dv = document.querySelector('div');
        spn.onmouseenter = function () {
            this.style.cursor = 'pointer';
        }
        spn.onclick = function () {
            dv.style.display = 'none';
        }
    </script>
</body>

</html>